﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities.Auditing;
using XHD.WXZJ.Users;

namespace XHD.WXZJ.Menus
{
   
    /// <summary>
    /// 菜单类
    /// </summary>
    public class Menu : CreationAuditedEntity<int, User>
    {
        /// <summary>
        /// 显示名称长度
        /// </summary>
        public const int MaxDisplayNameLength = 255;

        /// <summary>
        /// 名称校验规则
        /// </summary>
        public const string MenuNameRegex = "^[a-zA-Z][a-zA-Z0-9_-]{1,}$";
        /// <summary>
        /// 菜单名称
        /// </summary>

        public virtual string Name { get; set; }

        /// <summary>
        /// 显示名称
        /// </summary>
     
        public virtual string DisplayName { get; set; }

       /// <summary>
       /// 父节点ID
       /// </summary>
       public virtual int? ParentId { get; set; }

       /// <summary>
       /// 菜单URL
       /// </summary>
       public virtual string MenuUrl { get; set; }

       /// <summary>
       /// 菜单图标
       /// </summary>
       public virtual string MenuIcon { get; set; }
       /// <summary>
       /// 子菜单
       /// </summary>
       public virtual ICollection<Menu> ChildrenMenus{get; set;}
       #region 构造函数
       public Menu ()
        {
            
        }
       /// <summary>
       /// 构造函数
       /// </summary>
       /// <param name="parentId"></param>
       /// <param name="name"></param>
       /// <param name="displayName"></param>
        public Menu(int? parentId ,string name, string displayName)
        {
            ParentId = parentId;
            Name = name;
            DisplayName = displayName;
        }
        public Menu(int? parentId ,string name, string displayName,string menuUrl):this(parentId,name,displayName)
        {
            MenuUrl = menuUrl;
        }
        public Menu(int? parentId, string name, string displayName, string menuUrl,string icon)
            : this(parentId, name, displayName, menuUrl)
        {
            MenuIcon = icon;
        }
       #endregion
    }
}
